package common

import "fmt"

// JoinQueryStr
// 拼接get请求query字符串
func JoinQueryStr(url string, params map[string]interface{}) string {
	//参数拼接
	if params != nil {
		queryStr := ""
		for key, vl := range params {
			if queryStr == "" {
				queryStr = fmt.Sprintf("%s=%v", key, vl)
			} else {
				queryStr = fmt.Sprintf("%s&%s=%v", queryStr, key, vl)
			}
		}

		url = fmt.Sprintf("%s?%s", url, queryStr)
	}

	return url
}
